import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/views/index.vue'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)

export const constantRouterMap = [

  {
    path: '/',
    name: 'Index',
    component: Index
  },
  {
    path: '/kettle',
    name: 'KettleFlow',
    component: () => import('@/views/kettle/index.vue')
  },
  {
    path: '/bpmn',
    name: 'BpmnFlow',
    component: () => import('@/views/bpmn/index.vue')
  }

]

export default new Router({
  mode: 'history',
  routes: constantRouterMap
})
